package org.example.curriculum_design_6_16.entity.pojo;

import lombok.Data;
import java.io.Serializable;

@Data
public class RolePermissionKey implements Serializable {
    private String roleId;
    private String permissionId;

    // 必须实现 equals 和 hashCode 方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        RolePermissionKey that = (RolePermissionKey) o;

        if (roleId != null ? !roleId.equals(that.roleId) : that.roleId != null) return false;
        return permissionId != null ? permissionId.equals(that.permissionId) : that.permissionId == null;
    }

    @Override
    public int hashCode() {
        int result = roleId != null ? roleId.hashCode() : 0;
        result = 31 * result + (permissionId != null ? permissionId.hashCode() : 0);
        return result;
    }
}